package com.heima.user.controller.v1;

import com.heima.model.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.AuthDTO;
import com.heima.user.service.ApUserRealNameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
@Api(value = "用户认证controller",tags = "用户认证controller")
public class UserController {

    @Autowired
    ApUserRealNameService apUserService;

    @PostMapping("/list")
    @ApiOperation(value = "用户认证分页查询列表")
    public ResponseResult list(@RequestBody AuthDTO authDTO){
        return apUserService.list(authDTO);
    }

    @ApiOperation("自媒体用户审核 不通过")
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDTO authDTO){
        return apUserService.updateStatusById(authDTO, AdminConstants.FAIL_AUTH);
    }

    @ApiOperation("自媒体用户审核 通过")
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDTO authDTO){
        return apUserService.updateStatusById(authDTO,AdminConstants.PASS_AUTH);
    }

}
